package com.fabiodocarmo.calendario;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        GregorianCalendar calendar = new GregorianCalendar(2009, 1, 25);

        Date date = calendar.getTime();
        System.out.println(date);

        SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
        System.out.println(formato.format(date));

        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
        System.out.println(dayOfWeek);

        switch (dayOfWeek) {
        case Calendar.SUNDAY:
            System.out.println("Domingo");
            break;
        case Calendar.MONDAY:
            System.out.println("Segunda");
            break;
        case Calendar.TUESDAY:
            System.out.println("Terça");
            break;
        case Calendar.WEDNESDAY:
            System.out.println("Quarta");
            break;
        case Calendar.THURSDAY:
            System.out.println("Quinta");
            break;
        case Calendar.FRIDAY:
            System.out.println("Sexta");
            break;
        case Calendar.SATURDAY:
            System.out.println("Sábado");
            break;
        default:
            System.out.println("Não é dia de semana!!!");
            break;
        }

        int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
        System.out.println(dayOfYear);

        int ultimoDia = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
        System.out.println(ultimoDia);

    }
}
